export default {
  mode: 'universal',
  /*
   ** Headers of the page
   */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      {
        hid: 'description',
        name: 'description',
        content: process.env.npm_package_description || ''
      },
      { name: 'keywords', content: 'vue项目,传智播客,黑马程序员,前端vue项目,nuxt.js项目' },
      { name: 'author', content: '刘龙彬,liulongbin1314@outlook.com' }
    ],
    link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, { rel: 'stylesheet', href: 'https://unpkg.com/mint-ui/lib/style.css' }, { rel: 'stylesheet', href: 'https://unpkg.com/cube-ui/lib/cube.min.css' }, { rel: 'stylesheet', href: 'https://cdn.jsdelivr.net/npm/vant@2.0/lib/index.css' }],
    script: [{ src: 'https://cdn.staticfile.org/jquery/1.11.1/jquery.min.js' }, { src: 'https://cdn.staticfile.org/jquery.lazyload/1.9.1/jquery.lazyload.min.js' }]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: { color: '#fff' },
  /*
   ** Global CSS
   */
  css: ['assets/global.css'],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [{ src: '@/plugins/element-ui', ssr: true }, { src: '@/plugins/filter.js', ssr: true }],
  /*
   ** Nuxt.js modules
   */
  modules: ['@nuxtjs/eslint-module', '@nuxtjs/axios'],
  axios: {
    proxy: true
  },
  proxy: {
    // '/api': 'http://www.liulongbin.top:3005'
    '/api': {
      target: 'http://www.liulongbin.top:3005',
      // 路径重写，将 URL 路径中匹配到的 key，替换为指定的 value 值，参考：
      // https://blog.csdn.net/jikangjian/article/details/80798677
      // https://www.jianshu.com/p/a248b146c55a
      pathRewrite: { '^/api': '/api' }
    }
  },
  /*
   ** Build configuration
   */
  build: {
    transpile: [/^element-ui/, 'vue2-preview'],
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {
      // 只需要在 webpack 中配置 cube-ui 的映射关系即可
      config.resolve.alias['cube-ui'] = 'cube-ui/lib'
    }
  }
}
